/*
package com.har.modules.web.controller;

import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import com.google.common.base.Preconditions;
import com.har.common.config.UploadConfig;
import com.har.common.exception.RRException;
import com.har.common.utils.R;
import com.har.modules.web.entity.AppntEntity;
import com.har.modules.web.service.ExcelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.Arrays;
import java.util.List;

*/
/**
 * @author maoruidd
 * @desc: 文件上传
 * @create 2018-09-13 下午 4:13
 *//*


@Slf4j
@RestController
@RequestMapping("/upload")
public class UploadController {

    @Autowired
    private ExcelService excelService;
    @Autowired
    private UploadConfig uploadConfig;

    */
/**
     *
     * @param multipartFile
     * @return
     *//*

    @RequestMapping("/import/excel")
    public R importExcel(@RequestBody MultipartFile multipartFile) throws Exception {
        // 解析上传文件的数据，做匹配
        Preconditions.checkArgument(multipartFile != null, "文件不能为空");
        String[] suffixs = {"xls","xlsx"};
        Integer index =  multipartFile.getOriginalFilename().lastIndexOf(".");
        if(index <=0){
            throw new RRException("文件格式错误，请重新上传！",400);
        }
        String suffixName = multipartFile.getOriginalFilename().substring(index+1);

        log.info("文件名{}",multipartFile.getOriginalFilename());
        log.info("文件后缀名>>>{}",suffixName);
        if (!Arrays.asList(suffixs).contains(suffixName)) {
            throw new RRException("文件格式错误，请重新上传！",400);
        }

//        String uploadPath =  MessageFormat.format(,"");

        //解析文件
        ImportParams params = new ImportParams();
        params.setNeedSave(true);
        params.setSaveUrl(uploadConfig.getSavePath());
        params.setNeedVerfiy(true);
        params.setVerfiyGroup(new Class[]{AppntEntity.class});
        List<AppntEntity> list = ExcelImportUtil.importExcel(
                multipartFile.getInputStream(), AppntEntity.class, params);

        if(null == list || list.size() == 0){
            throw  new RRException("文件格式有误或数据有误",400);
        }

        //excelService
        excelService.importExcel();
        return R.ok();
    }


}
*/
